home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 December / PCWorld_2005-12_cd.bin / software / temacd / tiny / tpf-6[1].5.126.exe / Tiny Firewall 2005.msi / webui.dll / FIREWALL / FWN-VPN-PROTOCOL-VIEW.XSL < prev    next >
Encoding:
Extensible Markup Language  |  2005-08-17  |  70.6 KB  |  710 lines

  1.  ■<?xml version="1.0"?>
  2. <!--
  3. /*//////////////////////////////////////////////////////////////////////
  4. Filename:          fwn-protocol-view.xsl
  5. Company Name:      Computer Associates International, Inc.
  6. Legal Copyright: Copyright (c) Computer Associates International, Inc.
  7. Author:          Marek Matus (marek.matus@ca.com)
  8. Product:          Tiny Firewall
  9. Description:      get protocol view page
  10. ///////////////////////////////////////////////////////////////////////*/
  11.  -->
  12.  
  13. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
  14.         <xsl:output method="html"/>
  15.         
  16.         <!-- <xsl:include href="../common/tools.xsl"/> -->
  17.         <xsl:variable name="INCLUDED_FILES">../common/tools.xsl</xsl:variable>
  18.         
  19.         <xsl:variable name="routed" select="//Params/Param[@name='routed']"/>
  20.         <xsl:variable name="editable" select="//Params/Param[@name='editable']"/>
  21.         
  22.         <xsl:variable name="STR_PROTOCOL_TCP" select="//Params/Param[@name='STR_PROTOCOL_TCP']"/>
  23.         <xsl:variable name="STR_PROTOCOL_TCP_S" select="//Params/Param[@name='STR_PROTOCOL_TCP_S']"/>
  24.         <xsl:variable name="STR_PROTOCOL_UDP" select="//Params/Param[@name='STR_PROTOCOL_UDP']"/>
  25.         <xsl:variable name="STR_PROTOCOL_TCP_UDP" select="//Params/Param[@name='STR_PROTOCOL_TCP_UDP']"/>
  26.         <xsl:variable name="STR_PROTOCOL_ICMP" select="//Params/Param[@name='STR_PROTOCOL_ICMP']"/>
  27.         <xsl:variable name="STR_PROTOCOL_OTHER" select="//Params/Param[@name='STR_PROTOCOL_OTHER']"/>
  28.         <xsl:variable name="STR_PROTOCOL_IP" select="//Params/Param[@name='STR_PROTOCOL_IP']"/>
  29.         <xsl:variable name="STR_DIR_IN" select="//Params/Param[@name='STR_DIR_IN']"/>
  30.         <xsl:variable name="STR_DIR_OUT" select="//Params/Param[@name='STR_DIR_OUT']"/>
  31.         <xsl:variable name="STR_DIR_IN_OUT" select="//Params/Param[@name='STR_DIR_IN_OUT']"/>
  32.         
  33.         <!-- Get list of transport objects -->
  34.     <xsl:template match="/">                                                                                    
  35.             <xsl:choose>
  36.                 <xsl:when test="$routed='true'">
  37.                     <table class="nlist2" id="rules" style="border: 0px; width: 100%; border-bottom: 1px solid #D4D0C8;">
  38.                         <thead>
  39.                             <tr>                                
  40.                                 <th><xsl:value-of disable-output-escaping="yes" select="//Params/Param[@name='STR_PV_COL_LABEL']"/></th>
  41.                                 <th><xsl:value-of select="//Params/Param[@name='STR_PV_COL_USERS_GROUPS']"/></th>
  42.                                 <th><xsl:value-of select="//Params/Param[@name='STR_PV_COL_TARGET']"/></th>
  43.                                 <th><xsl:value-of select="//Params/Param[@name='STR_PV_COL_REMOVE']"/></th>
  44.                                 <th><xsl:value-of select="//Params/Param[@name='STR_PV_COL_ACTION']"/></th>
  45.                             </tr>
  46.                         </thead>
  47.                         <tbody>
  48.                             <xsl:choose>
  49.                                 <xsl:when test="count(//Definitions/Object[@ot='iptransport' and (Item/@prot='tcp' or Item/@prot='udp' or Item/@prot='tcp_udp')]) > 0">
  50.                                     <xsl:for-each select="//Definitions/Object[@ot='iptransport' and (Item/@prot='tcp' or Item/@prot='udp' or Item/@prot='tcp_udp')]">
  51.                                         <xsl:sort select="@id"/>
  52.                                         
  53.                                         <xsl:apply-templates select="." mode="routed">
  54.                                             <xsl:with-param name="class">                                                
  55.                                                 <xsl:choose>
  56.                                                     <xsl:when test="(position() mod 2) = 0">even</xsl:when>
  57.                                                     <xsl:otherwise>odd</xsl:otherwise>
  58.                                                 </xsl:choose>                
  59.                                             </xsl:with-param>
  60.                                         </xsl:apply-templates>
  61.                                     </xsl:for-each>     
  62.                                 </xsl:when>
  63.                                 <xsl:otherwise>
  64.                                     <xsl:call-template name="noObjectFoundRouted"/>
  65.                                 </xsl:otherwise>
  66.                             </xsl:choose>
  67.                         </tbody>
  68.                     </table>
  69.                 </xsl:when>
  70.                 <xsl:otherwise>
  71.                     <table class="nlist2" id="rules" style="border: 0px; width: 100%; border-bottom: 1px solid #D4D0C8;">
  72.                         <thead>
  73.                             <tr>
  74.                                 <th><xsl:value-of disable-output-escaping="yes" select="//Params/Param[@name='STR_PV_COL_LABEL']"/></th>
  75.                                 <th><xsl:value-of select="//Params/Param[@name='STR_PV_COL_USERS_GROUPS']"/></th>
  76.                                 <th><xsl:value-of select="//Params/Param[@name='STR_PV_COL_TYPEOFUSER']"/></th>
  77.                                 <th><xsl:value-of select="//Params/Param[@name='STR_PV_COL_LOCIP']"/></th>
  78.                                 <th><xsl:value-of select="//Params/Param[@name='STR_PV_COL_REMOVE']"/></th>
  79.                                 <th><xsl:value-of select="//Params/Param[@name='STR_PV_COL_ACTION']"/></th>
  80.                             </tr>
  81.                         </thead>
  82.                         <tbody>
  83.                             <xsl:choose>
  84.                                 <xsl:when test="count(//Definitions/Object[@ot='iptransport']) > 0">
  85.                                     <xsl:for-each select="//Definitions/Object[@ot='iptransport']">
  86.                                         <xsl:sort select="@id"/>
  87.                                         
  88.                                         <xsl:apply-templates select="." mode="normal">
  89.                                             <xsl:with-param name="class">                                                
  90.                                                 <xsl:choose>
  91.                                                     <xsl:when test="(position() mod 2) = 0">even</xsl:when>
  92.                                                     <xsl:otherwise>odd</xsl:otherwise>
  93.                                                 </xsl:choose>                
  94.                                             </xsl:with-param>
  95.                                         </xsl:apply-templates>
  96.                                     </xsl:for-each>     
  97.                                 </xsl:when>
  98.                                 <xsl:otherwise>
  99.                                     <xsl:call-template name="noObjectFoundNormal"/>
  100.                                 </xsl:otherwise>
  101.                             </xsl:choose>
  102.                         </tbody>
  103.                     </table>
  104.                 </xsl:otherwise>
  105.             </xsl:choose>
  106.         </xsl:template>
  107.                 
  108.         <!-- Get protocol info -->
  109.         <xsl:template match="Object" mode="protocol">
  110.             <strong><xsl:value-of select="@id"/></strong>
  111.             <span class="tradd">
  112.                 <xsl:text> (</xsl:text>
  113.                     <xsl:call-template name="getProtocol">
  114.                         <xsl:with-param name="strConstProtocol" select="./Item/@prot"/>
  115.                         <xsl:with-param name="strProtNums" select="./Item/@prot_num"/>
  116.                     </xsl:call-template>
  117.                 
  118.                 <xsl:text>, </xsl:text>
  119.                 <xsl:call-template name="getDirection">
  120.                     <xsl:with-param name="strConstDir" select="./Item/@dir"/>
  121.                 </xsl:call-template>
  122.         
  123.                 <xsl:text>, </xsl:text>
  124.                 <xsl:choose>
  125.                     <xsl:when test="./Item/@locport">                        
  126.                         <xsl:value-of select="./Item/@locport"/>                        
  127.                     </xsl:when>
  128.                     <xsl:otherwise>
  129.                         <xsl:value-of select="//Params/Param[@name='STR_PORT_ANY']"/>
  130.                     </xsl:otherwise>
  131.                 </xsl:choose>
  132.         
  133.                 <xsl:text>, </xsl:text>
  134.                 <xsl:choose>
  135.                     <xsl:when test="./Item/@remport">                        
  136.                         <xsl:value-of select="./Item/@remport"/>                        
  137.                     </xsl:when>
  138.                     <xsl:otherwise>
  139.                         <xsl:value-of select="//Params/Param[@name='STR_PORT_ANY']"/>
  140.                     </xsl:otherwise>
  141.                 </xsl:choose>
  142.                 <xsl:text>)</xsl:text>
  143.             </span>
  144.         </xsl:template>
  145.         
  146.         <!-- process object -->
  147.         <xsl:template match="Object" mode="routed">                        
  148.             <xsl:param name="class"/>
  149.             <xsl:variable name="grplist">
  150.                 <xsl:call-template name="getUserGroupListRouted">
  151.                     <xsl:with-param name="id" select="@id"/>
  152.                     <xsl:with-param name="class" select="$class"/>
  153.                 </xsl:call-template>
  154.             </xsl:variable>
  155.             
  156.             <xsl:variable name="rowspan" select="count(msxsl:node-set($grplist)/tr)"/>
  157.             
  158.             <!-- printable variables -->
  159.             <xsl:variable name="id_js">
  160.                 <xsl:call-template name="printJSText">
  161.                         <xsl:with-param name="string" select="@id"/>
  162.                     </xsl:call-template>
  163.             </xsl:variable>
  164.             
  165.             <tr objId="{$id_js}" class="{$class}">
  166.                 <td rowspan="{$rowspan}">
  167.                     <xsl:apply-templates select="." mode="protocol"/>
  168.                 </td>
  169.                 <xsl:choose>
  170.                     <xsl:when test="$rowspan>0">
  171.                         <xsl:copy-of select="msxsl:node-set($grplist)/tr[1]/td[1]"/>
  172.                         <xsl:copy-of select="msxsl:node-set($grplist)/tr[1]/td[2]"/>
  173.                         <xsl:copy-of select="msxsl:node-set($grplist)/tr[1]/td[3]"/>
  174.                     </xsl:when>
  175.                     <xsl:otherwise>
  176.                         <td/>
  177.                         <td/>
  178.                         <td/>
  179.                     </xsl:otherwise>
  180.                 </xsl:choose>
  181.                 <td rowspan="{$rowspan}" class="action">
  182.                     <xsl:if test="$editable='true'">
  183.                         <a href="#" onclick="initForm('floatMenuForm11','{$id_js}'); toggleFloatMenu(this, 'addVPNUserMenu', 'rules','rules_wrapper'); return false;">
  184.                             <xsl:value-of select="//Params/Param[@name='STR_PV_COL_ACTION_ADD_VPN']"/>
  185.                         </a>
  186.                         <br/>
  187.                         <a href="#" onclick="initForm('floatMenuFormAddNetUser','{$id_js}'); toggleFloatMenu(this, 'addNetUserMenu', 'rules','rules_wrapper'); return false;">
  188.                             <xsl:value-of select="//Params/Param[@name='STR_PV_COL_ACTION_ADD_NET']"/>
  189.                         </a>
  190.                     </xsl:if>
  191.                 </td>
  192.             </tr>
  193.             <xsl:if test="$rowspan>1">
  194.                 <xsl:for-each select="msxsl:node-set($grplist)/tr">
  195.                     <xsl:if test="position()!=1">
  196.                         <xsl:copy-of select="."/>
  197.                     </xsl:if>
  198.                 </xsl:for-each>
  199.             </xsl:if>
  200.         </xsl:template>
  201.         
  202.         <xsl:template match="Object" mode="normal">                        
  203.             <xsl:param name="class"/>
  204.             
  205.             <xsl:variable name="grplist">
  206.                 <xsl:call-template name="getUserGroupListNormal">
  207.                     <xsl:with-param name="id" select="@id"/>
  208.                     <xsl:with-param name="class" select="$class"/>
  209.                 </xsl:call-template>
  210.             </xsl:variable>
  211.             
  212.             <xsl:variable name="rowspan" select="count(msxsl:node-set($grplist)/tr)"/>
  213.             
  214.             <!-- printable variables -->
  215.             <xsl:variable name="id_js">
  216.                 <xsl:call-template name="printJSText">
  217.                         <xsl:with-param name="string" select="@id"/>
  218.                     </xsl:call-template>
  219.             </xsl:variable>
  220.             
  221.             <tr objId="{$id_js}" class="{$class}">
  222.                                 
  223.                 <td rowspan="{$rowspan}">                    
  224.                     <xsl:apply-templates select="." mode="protocol"/>
  225.                 </td>
  226.                 
  227.                 <xsl:choose>
  228.                     <xsl:when test="$rowspan>0">
  229.                         <xsl:copy-of select="msxsl:node-set($grplist)/tr[1]/td[1]"/>
  230.                         <xsl:copy-of select="msxsl:node-set($grplist)/tr[1]/td[2]"/>
  231.                         <xsl:copy-of select="msxsl:node-set($grplist)/tr[1]/td[3]"/>
  232.                         <xsl:copy-of select="msxsl:node-set($grplist)/tr[1]/td[4]"/>
  233.                     </xsl:when>
  234.                     <xsl:otherwise>
  235.                         <td/>
  236.                         <td/>
  237.                         <td/>
  238.                         <td/>
  239.                     </xsl:otherwise>
  240.                 </xsl:choose>
  241.                                 
  242.                 <td rowspan="{$rowspan}" class="action" ruleId="{@id}">
  243.                     <xsl:if test="$editable='true'">
  244.                         <a href="#" onclick="initForm('floatMenuFormAddVPNUserNormal','{$id_js}'); toggleFloatMenu(this, 'addVPNUserMenuNormal', 'rules','rules_wrapper'); return false;">
  245.                             <xsl:value-of select="//Params/Param[@name='STR_PV_COL_ACTION_USER_GROUP']"/>
  246.                         </a>
  247.                     </xsl:if>
  248.                 </td>
  249.             </tr>
  250.             
  251.             <xsl:if test="$rowspan>1">
  252.                 <xsl:for-each select="msxsl:node-set($grplist)/tr">
  253.                     <xsl:if test="position()!=1">
  254.                         <xsl:copy-of select="."/>
  255.                     </xsl:if>
  256.                 </xsl:for-each>
  257.             </xsl:if>
  258.         </xsl:template>
  259.         
  260.         <!-- Get rule list -->
  261.         <xsl:template name="getUserGroupListRouted">
  262.             <xsl:param name="id"/>
  263.             <xsl:param name="class"/>
  264.             
  265.             <!-- process routed rules -->
  266.             <xsl:for-each select="//RoutedRuleList/RoutedRule[AccessDesc/@ar!='Prevent' and @transport_id=$id and (not(@disabled) or @disabled='0') and (starts-with(@remaddr_id,'RUser:') or starts-with(@remaddr_id,'RGroup:'))]">
  267.                 <xsl:sort select="@remaddr_id"/> 
  268.                 
  269.                 <xsl:apply-templates select="." mode="rem">                    
  270.                     <xsl:with-param name="class" select="$class"/>
  271.                 </xsl:apply-templates>
  272.             </xsl:for-each>
  273.             
  274.             <!-- do not get rules which were returned in previous cycle! -->
  275.             <xsl:for-each select="//RoutedRuleList/RoutedRule[AccessDesc/@ar!='Prevent' and @transport_id=$id and (not(@disabled) or @disabled='0') and (starts-with(@lanaddr_id,'User:') or starts-with(@lanaddr_id,'Group:')) and not(starts-with(@remaddr_id,'RUser:') or starts-with(@remaddr_id,'RGroup:'))]">
  276.                 <xsl:sort select="@remaddr_id"/>                            
  277.                 
  278.                 <xsl:apply-templates select="." mode="lan">                    
  279.                     <xsl:with-param name="class" select="$class"/>
  280.                 </xsl:apply-templates>
  281.             </xsl:for-each>                
  282.         </xsl:template>    
  283.         
  284.         <!-- Get rule list -->
  285.         <xsl:template name="getUserGroupListNormal">
  286.             <xsl:param name="id"/>
  287.             <xsl:param name="class"/>
  288.                         
  289.             <!-- process local rules -->
  290.             <xsl:for-each select="//RuleList/Rule[AccessDesc/@ar!='Prevent' and @transport_id=$id and (not(@disabled) or @disabled='0') and (starts-with(@remaddr_id,'RUser:') or starts-with(@remaddr_id,'RGroup:') or starts-with(@remaddr_id,'User:') or starts-with(@remaddr_id,'Group:'))]">
  291.                 <xsl:sort select="@remaddr_id"/> 
  292.                 
  293.                 <xsl:apply-templates select="." mode="rem">                    
  294.                     <xsl:with-param name="class" select="$class"/>
  295.                 </xsl:apply-templates>
  296.             </xsl:for-each>
  297.         </xsl:template>
  298.         <!-- Process routed rule for remote address -->
  299.         <xsl:template match="RoutedRule" mode="rem">                        
  300.             <xsl:param name="class"/>
  301.             
  302.             <!-- printable variables -->
  303.             <xsl:variable name="transport_id_js">
  304.                 <xsl:call-template name="printJSText">
  305.                         <xsl:with-param name="string" select="@transport_id"/>
  306.                     </xsl:call-template>
  307.             </xsl:variable>
  308.                     
  309.             <tr objId="{$transport_id_js}" class="{$class}">
  310.                 <td ruleId="{@id}">
  311.                     <xsl:call-template name="processLDAPName">
  312.                         <xsl:with-param name="name" select="@remaddr_id"/>
  313.                     </xsl:call-template>
  314.                 </td>
  315.                 <td class="menu" ruleId="{@id}">
  316.                     <!-- check if lanaddr_id is valid -->
  317.                     <xsl:variable name="isValid">
  318.                         <xsl:call-template name="isValidObj">
  319.                             <xsl:with-param name="objid" select="@lanaddr_id"/>
  320.                         </xsl:call-template>
  321.                     </xsl:variable>
  322.                     
  323.                     <!-- process remaddr -->
  324.                     <xsl:variable name="lanaddr">
  325.                         <xsl:choose>                                                        
  326.                             <xsl:when test="@lanaddr_id">
  327.                                 <xsl:call-template name="processLDAPName">
  328.                                     <xsl:with-param name="name" select="@lanaddr_id"/>
  329.                                 </xsl:call-template>
  330.                             </xsl:when>
  331.                             <xsl:otherwise>
  332.                                 <xsl:value-of select="@lanaddr"/>
  333.                             </xsl:otherwise>
  334.                         </xsl:choose>
  335.                     </xsl:variable>
  336.                     
  337.                     <!-- printable variables -->
  338.                     <xsl:variable name="lanaddr_id_js">
  339.                         <xsl:call-template name="printJSText">
  340.                                 <xsl:with-param name="string" select="@lanaddr_id"/>
  341.                             </xsl:call-template>
  342.                     </xsl:variable>
  343.                     
  344.                     <xsl:variable name="lanaddr_js">
  345.                         <xsl:call-template name="printJSText">
  346.                                 <xsl:with-param name="string" select="@lanaddr"/>
  347.                             </xsl:call-template>
  348.                     </xsl:variable>
  349.                     
  350.                     <xsl:if test="$editable='true'">
  351.                         <a href="#" onclick="initForm( 'floatMenuFormLANAIP', '{@id}', true); initLanAddress('{$transport_id_js}','{$lanaddr_id_js}','{$lanaddr_js}'); toggleFloatMenu(this, 'lanIPAddrMenu', 'rules','rules_wrapper'); return false;">
  352.                             <xsl:choose>
  353.                                 <xsl:when test="$isValid='true'">    
  354.                                     <xsl:value-of select="$lanaddr"/>
  355.                                 </xsl:when>
  356.                                 <xsl:otherwise>
  357.                                     <span class="invalid">
  358.                                         <xsl:value-of select="$lanaddr"/>
  359.                                     </span>
  360.                                 </xsl:otherwise>
  361.                             </xsl:choose>                      
  362.                         </a>
  363.                     </xsl:if>
  364.                 </td>
  365.                 <td class="action" ruleId="{@id}">
  366.                     <xsl:if test="$editable='true'">
  367.                         <a href="#" onclick="RemoveRule('{@id}','{$transport_id_js}',true); return false;">
  368.                             <img src="../img/ico-remove.gif">
  369.                                 <xsl:attribute name="title">
  370.                                     <xsl:value-of select="//Params/Param[@name='STR_PV_COL_ACTION_REMOVE_TIP']"/>
  371.                                 </xsl:attribute>
  372.                             </img>
  373.                         </a>
  374.                     </xsl:if>
  375.                 </td>
  376.             </tr>
  377.         </xsl:template>
  378.         
  379.         <!-- Process routed rule for lan address -->
  380.         <xsl:template match="RoutedRule" mode="lan">                        
  381.             <xsl:param name="class"/>
  382.             
  383.             <!-- printable variables -->
  384.             <xsl:variable name="transport_id_js">
  385.                 <xsl:call-template name="printJSText">
  386.                         <xsl:with-param name="string" select="@transport_id"/>
  387.                     </xsl:call-template>
  388.             </xsl:variable>
  389.             <tr objId="{$transport_id_js}" class="{$class}">
  390.                 <td ruleId="{@id}">
  391.                     <xsl:call-template name="processLDAPName">
  392.                         <xsl:with-param name="name" select="@lanaddr_id"/>
  393.                     </xsl:call-template>
  394.                 </td>
  395.                 <td class="menu" ruleId="{@id}">
  396.                     <!-- check if remaddr_id is valid -->
  397.                     <xsl:variable name="isValid">
  398.                         <xsl:call-template name="isValidObj">
  399.                             <xsl:with-param name="objid" select="@remaddr_id"/>
  400.                         </xsl:call-template>
  401.                     </xsl:variable>
  402.                     
  403.                     <!-- process remaddr -->
  404.                     <xsl:variable name="remaddr">
  405.                         <xsl:choose>                                                        
  406.                             <xsl:when test="@remaddr_id">
  407.                                 <xsl:call-template name="processLDAPName">
  408.                                     <xsl:with-param name="name" select="@remaddr_id"/>
  409.                                 </xsl:call-template>
  410.                             </xsl:when>
  411.                             <xsl:otherwise>
  412.                                 <xsl:value-of select="@remaddr"/>
  413.                             </xsl:otherwise>
  414.                         </xsl:choose>
  415.                     </xsl:variable>
  416.                     
  417.                     <!-- printable variables -->
  418.                     <xsl:variable name="remaddr_id_js">
  419.                         <xsl:call-template name="printJSText">
  420.                                 <xsl:with-param name="string" select="@remaddr_id"/>
  421.                             </xsl:call-template>
  422.                     </xsl:variable>
  423.                     <xsl:variable name="remaddr_js">
  424.                         <xsl:call-template name="printJSText">
  425.                                 <xsl:with-param name="string" select="@remaddr"/>
  426.                             </xsl:call-template>
  427.                     </xsl:variable>
  428.                     
  429.                     <xsl:if test="$editable='true'">
  430.                         <a href="#" onclick="initForm( 'floatMenuFormRemIP', '{@id}', true); initRemAddress('{$transport_id_js}','{$remaddr_id_js}','{$remaddr_js}'); toggleFloatMenu(this, 'remIPAddrMenu', 'rules','rules_wrapper'); return false;">
  431.                             <xsl:choose>
  432.                                 <xsl:when test="$isValid='true'">    
  433.                                     <xsl:value-of select="$remaddr"/>
  434.                                 </xsl:when>
  435.                                 <xsl:otherwise>
  436.                                     <span class="invalid">
  437.                                         <xsl:value-of select="$remaddr"/>
  438.                                     </span>
  439.                                 </xsl:otherwise>
  440.                             </xsl:choose>
  441.                         </a>
  442.                     </xsl:if>
  443.                 </td>
  444.                 <td class="action" ruleId="{@id}">
  445.                     <xsl:if test="$editable='true'">
  446.                         <a href="#" onclick="RemoveRule('{@id}','{$transport_id_js}',true); return false;">
  447.                             <img src="../img/ico-remove.gif">
  448.                                 <xsl:attribute name="title">
  449.                                     <xsl:value-of select="//Params/Param[@name='STR_PV_COL_ACTION_REMOVE_TIP']"/>
  450.                                 </xsl:attribute>
  451.                             </img>
  452.                         </a>
  453.                     </xsl:if>
  454.                 </td>
  455.             </tr>
  456.         </xsl:template>                
  457.         
  458.         <!-- Process normal rule for remote address -->
  459.         <xsl:template match="Rule" mode="rem">
  460.             <xsl:param name="class"/>
  461.             <xsl:if test="@desc='' or not(@desc) or starts-with(@desc,'@@:m;')">
  462.                 <!-- printable variables -->
  463.                 <xsl:variable name="transport_id_js">
  464.                     <xsl:call-template name="printJSText">
  465.                             <xsl:with-param name="string" select="@transport_id"/>
  466.                         </xsl:call-template>
  467.                 </xsl:variable>
  468.                 
  469.                 <tr objId="{$transport_id_js}" class="{$class}">
  470.                     <td ruleId="{@id}">
  471.                         <xsl:call-template name="processLDAPName">
  472.                             <xsl:with-param name="name" select="@remaddr_id"/>
  473.                         </xsl:call-template>
  474.                     </td>
  475.                     
  476.                     <td ruleId="{@id}" class="menu">
  477.                         <xsl:variable name="opStrID" select="substring-after(@desc, '@@:m;')" />
  478.                         
  479.                         <xsl:choose>
  480.                             <xsl:when test="$editable='true'">
  481.                                 <a href="#" onclick="initForm( 'floatMenuForm_TypeOfUser', '{@id}', false); initTypeOfUser('{$transport_id_js}'); toggleFloatMenu(this, 'typeOfUserMenu', 'rules','rules_wrapper'); return false;">
  482.                                     <xsl:choose>
  483.                                         <xsl:when test="not($opStrID='')">
  484.                                             <xsl:value-of select="//Params/Param[@name='STR_TYPEOFUSER_BOTH']"/>
  485.                                         </xsl:when>
  486.                                         <xsl:when test="starts-with(@remaddr_id,'RUser:') or starts-with(@remaddr_id,'RGroup:')">
  487.                                             <xsl:value-of select="//Params/Param[@name='STR_TYPEOFUSER_VPN']"/>
  488.                                         </xsl:when>
  489.                                         <xsl:when test="starts-with(@remaddr_id,'User:') or starts-with(@remaddr_id,'Group:')">
  490.                                             <xsl:value-of select="//Params/Param[@name='STR_TYPEOFUSER_LAN']"/>
  491.                                         </xsl:when>
  492.                                     </xsl:choose>
  493.                                 </a>
  494.                             </xsl:when>
  495.                             <xsl:otherwise>
  496.                                 <xsl:choose>
  497.                                     <xsl:when test="not($opStrID='')">
  498.                                         <xsl:value-of select="//Params/Param[@name='STR_TYPEOFUSER_BOTH']"/>
  499.                                     </xsl:when>
  500.                                     <xsl:when test="starts-with(@remaddr_id,'RUser:') or starts-with(@remaddr_id,'RGroup:')">
  501.                                         <xsl:value-of select="//Params/Param[@name='STR_TYPEOFUSER_VPN']"/>
  502.                                     </xsl:when>
  503.                                     <xsl:when test="starts-with(@remaddr_id,'User:') or starts-with(@remaddr_id,'Group:')">
  504.                                         <xsl:value-of select="//Params/Param[@name='STR_TYPEOFUSER_LAN']"/>
  505.                                     </xsl:when>
  506.                                 </xsl:choose>
  507.                             </xsl:otherwise>
  508.                         </xsl:choose>
  509.                     </td>
  510.                     
  511.                     <td class="menu" ruleId="{@id}">
  512.                         <!-- check if locaddr_id is valid -->
  513.                         <xsl:variable name="isValid">
  514.                             <xsl:call-template name="isValidObj">
  515.                                 <xsl:with-param name="objid" select="@locaddr_id"/>
  516.                             </xsl:call-template>
  517.                         </xsl:variable>
  518.                         
  519.                         <!-- process locaddr -->
  520.                         <xsl:variable name="locaddr">
  521.                             <xsl:choose>                                                        
  522.                                 <xsl:when test="@locaddr_id">
  523.                                     <xsl:call-template name="processLDAPName">
  524.                                         <xsl:with-param name="name" select="@locaddr_id"/>
  525.                                     </xsl:call-template>
  526.                                 </xsl:when>
  527.                                 <xsl:otherwise>
  528.                                     <xsl:value-of select="@locaddr"/>
  529.                                 </xsl:otherwise>
  530.                             </xsl:choose>
  531.                         </xsl:variable>
  532.                         
  533.                         <!-- printable variables -->
  534.                         <xsl:variable name="locaddr_id_js">
  535.                             <xsl:call-template name="printJSText">
  536.                                     <xsl:with-param name="string" select="@locaddr_id"/>
  537.                                 </xsl:call-template>
  538.                         </xsl:variable>
  539.     
  540.                         <xsl:variable name="locaddr_js">
  541.                             <xsl:call-template name="printJSText">
  542.                                     <xsl:with-param name="string" select="@locaddr"/>
  543.                                 </xsl:call-template>
  544.                         </xsl:variable>
  545.                         
  546.                         <xsl:choose>
  547.                             <xsl:when test="$editable='true'">
  548.                                 <a href="#" onclick="initForm( 'floatMenuFormLANAIP', '{@id}', false); initLanAddress('{$transport_id_js}','{$locaddr_id_js}','{$locaddr_js}'); toggleFloatMenu(this, 'lanIPAddrMenu', 'rules','rules_wrapper'); return false;">
  549.                                     <xsl:choose>
  550.                                         <xsl:when test="$isValid='true'">    
  551.                                             <xsl:value-of select="$locaddr"/>
  552.                                         </xsl:when>
  553.                                         <xsl:otherwise>
  554.                                             <span class="invalid">
  555.                                                 <xsl:value-of select="$locaddr"/>
  556.                                             </span>
  557.                                         </xsl:otherwise>
  558.                                     </xsl:choose>                                                                            
  559.                                 </a>
  560.                             </xsl:when>
  561.                             <xsl:otherwise>
  562.                                 <xsl:choose>
  563.                                     <xsl:when test="$isValid='true'">    
  564.                                         <xsl:value-of select="$locaddr"/>
  565.                                     </xsl:when>
  566.                                     <xsl:otherwise>
  567.                                         <span class="invalid">
  568.                                             <xsl:value-of select="$locaddr"/>
  569.                                         </span>
  570.                                     </xsl:otherwise>
  571.                                 </xsl:choose>                                                                            
  572.                             </xsl:otherwise>
  573.                         </xsl:choose>
  574.                     </td>
  575.                     <td class="action" ruleId="{@id}">
  576.                         <xsl:if test="$editable='true'">
  577.                             <a href="#" onclick="RemoveRule('{@id}','{$transport_id_js}',false); return false;">
  578.                                 <img src="../img/ico-remove.gif">
  579.                                     <xsl:attribute name="title">
  580.                                         <xsl:value-of select="//Params/Param[@name='STR_PV_COL_ACTION_REMOVE_TIP']"/>
  581.                                     </xsl:attribute>
  582.                                 </img>
  583.                             </a>
  584.                         </xsl:if>
  585.                     </td>
  586.                 </tr>
  587.             </xsl:if>
  588.         </xsl:template>
  589.         
  590.         <!-- process no object row -->
  591.         <xsl:template name="noObjectFoundRouted">                        
  592.             <tr class="odd">
  593.                 <td colspan="6">
  594.                     <xsl:value-of select="//Params/Param[@name='STR_TR_NO_ROW']"/>
  595.                 </td>
  596.             </tr>
  597.         </xsl:template>
  598.         
  599.         <xsl:template name="noObjectFoundNormal">                        
  600.             <tr class="odd">
  601.                 <td colspan="6">
  602.                     <xsl:value-of select="//Params/Param[@name='STR_TR_NO_ROW']"/>
  603.                 </td>
  604.             </tr>
  605.         </xsl:template>                
  606.         
  607.         <!-- If it is LDAP name then remove part befor : and arter @. -->
  608.         <xsl:template name="processLDAPName">
  609.             <xsl:param name="name"/>
  610.             
  611.             <xsl:variable name="strip1" select='substring-after($name,":")'/>
  612.             <xsl:variable name="final" select='substring-before($strip1,"@")'/>
  613.             
  614.             <xsl:choose>
  615.                 <xsl:when test="$final">
  616.                     <xsl:value-of select="$final"/>
  617.                 </xsl:when>
  618.                 <xsl:otherwise>
  619.                     <!-- when it is not probably LDAP name -->                    
  620.                     <xsl:value-of select="$name"/>
  621.                 </xsl:otherwise>
  622.             </xsl:choose>
  623.         </xsl:template>
  624.         
  625.         <!-- Check if predefined obj is valid (is specified) in database -->
  626.         <xsl:template name="isValidObj">
  627.             <xsl:param name="objid"/>
  628.                         
  629.             <xsl:choose>
  630.                 <xsl:when test="not($objid)">
  631.                     <xsl:text>true</xsl:text>
  632.                 </xsl:when>
  633.                 
  634.                 <xsl:otherwise>                                
  635.                     <xsl:if test="//Definitions/Object[@id=$objid and @ot='ipaddress']">
  636.                         <xsl:text>true</xsl:text>
  637.                     </xsl:if>                    
  638.                 </xsl:otherwise>
  639.             </xsl:choose>
  640.         </xsl:template>
  641.         
  642.     <xsl:template name="getProtocol">
  643.         <xsl:param name="strConstProtocol"/>
  644.         <xsl:param name="strProtNums"/>
  645.     
  646.         <xsl:choose>
  647.             <xsl:when test="$strConstProtocol='tcp'">
  648.                 <xsl:value-of select="$STR_PROTOCOL_TCP"/>
  649.             </xsl:when>
  650.             
  651.             <xsl:when test="$strConstProtocol='tcp_s'">
  652.                 <xsl:value-of select="$STR_PROTOCOL_TCP_S"/>
  653.             </xsl:when>
  654.             <xsl:when test="$strConstProtocol='udp'">
  655.                 <xsl:value-of select="$STR_PROTOCOL_UDP"/>
  656.             </xsl:when>
  657.             <xsl:when test="$strConstProtocol='tcp_udp'">
  658.                 <xsl:value-of select="$STR_PROTOCOL_TCP_UDP"/>
  659.             </xsl:when>
  660.             <xsl:when test="$strConstProtocol='icmp'">
  661.                 <xsl:value-of select="$STR_PROTOCOL_ICMP"/>
  662.             </xsl:when>
  663.             <xsl:when test="$strConstProtocol='other'">
  664.                 <xsl:value-of select="$STR_PROTOCOL_OTHER"/>
  665.                 <xsl:text> (</xsl:text>
  666.                 <xsl:value-of select="$strProtNums"/>
  667.                 <xsl:text>)</xsl:text>
  668.             </xsl:when>
  669.             <xsl:when test="$strConstProtocol='ip'">
  670.                 <xsl:value-of select="$STR_PROTOCOL_IP"/>
  671.             </xsl:when>
  672.             
  673.             <xsl:otherwise>
  674.                 <xsl:value-of select="$strConstProtocol"/>
  675.             </xsl:otherwise>
  676.         </xsl:choose>
  677.     
  678.     </xsl:template>
  679.     
  680.     <xsl:template name="getDirection">
  681.         <xsl:param name="strConstDir"/>
  682.         
  683.         <xsl:choose>
  684.             <xsl:when test="$strConstDir='in'">
  685.                 <xsl:value-of select="$STR_DIR_IN"/>
  686.             </xsl:when>
  687.             
  688.             <xsl:when test="$strConstDir='out'">
  689.                 <xsl:value-of select="$STR_DIR_OUT"/>
  690.             </xsl:when>
  691.             
  692.             <xsl:otherwise>
  693.                 <xsl:value-of select="$STR_DIR_IN_OUT"/>
  694.             </xsl:otherwise>
  695.         </xsl:choose>
  696.     </xsl:template>
  697.                         
  698. </xsl:stylesheet>